#!/bin/bash

logo=$(cat <<'EOF'
     ______ _                 _         _   _             _    
    |  ____| |               | |       | | | |           | |   
    | |__  | | ___   ___   __| |   __ _| |_| |_ __ _  ___| | __
    |  __| | |/ _ \ / _ \ / _` |  / _` | __| __/ _` |/ __| |/ /
    | |    | | (_) | (_) | (_| | | (_| | |_| || (_| | (__|   < 
    |_|    |_|\___/ \___/ \__,_|  \__,_|\__|\__\__,_|\___|_|\_\
EOF
)
echo -e "$logo"

echo -e "\033[1;32;40m[*] Flood_attack is a type of network attack that overwhelms the target system by sending a large number of malicious requests or packets, causing its resources to be exhausted and unable to function normally.\033[1;37;40m"

declare -A files
files=(
     ["1"]="ddos/Flood_attack/ACK_Flood.py"
     ["2"]="ddos/Flood_attack/DNS_Query_Flood.py"
     ["3"]="ddos/Flood_attack/ICMP_Flood.py"
     ["4"]="ddos/Flood_attack/Ntp_Request_Flood.py"
     ["5"]="ddos/Flood_attack/UDP_Reflection_Flood.py"
     ["6"]="ddos/Flood_attack/Connection_Flood.py"
     ["7"]="ddos/Flood_attack/HTTP_Flood.py"
     ["8"]="ddos/Flood_attack/IP_lood.py"
     ["9"]="ddos/Flood_attack/SYN_Flood.py"
     ["10"]="ddos/Flood_attack/HTTP_Flood_AMT.py"
     ["11"]="ddos/Flood_attack/UDP_Flood_AMT.py"
     ["12"]="ddos/Flood_attack/Advanced_IP_Flooding.py"
     ["13"]="ddos/Flood_attack/Advanced_HTTP_Flooding.py"
     ["14"]="ddos/Flood_attack/Advanced_ICMP_Flooding.py"
     ["15"]="ddos/Flood_attack/Advanced_DNS_Query_Flood.py"
     ["16"]="ddos/Flood_attack/Advanced_UDP_Reflection_Flood.py"
     ["17"]="ddos/Flood_attack/Advanced_SYN_Flood.py"
)

while true; do
     choice=$(whiptail --title "DDoS Attack Types" --menu "Flood_attack is a type of network attack that overwhelms the target system by sending a large number of malicious requests or packets, causing its resources to be exhausted and unable to function normally.\n\nPlease select an attack mode:" 35 78 20 \
     "1" "ACK Flood (ACK Flood Attack)" \
     "2" "DNS Query Flood (DNS Query Flood Attack)" \
     "3" "ICMP Flood (ICMP Flood Attack)" \
     "4" "NTP Request Flood (NTP Request Flood Attack)" \
     "5" "UDP Reflection Flood (UDP Reflection Flood Attack)" \
     "6" "Connection Flood (Connection Flood Attack)" \
     "7" "HTTP Flood (HTTP Flood Attack)" \
     "8" "IP Flood (IP Flood Attack)" \
     "9" "SYN Flood (SYN Flood Attack)" \
     "10" "HTTP Flood Attack on Multiple Targets (HTTP Flood Attack on Multiple Targets Edition)" \
     "11" "UDP Flood Attack on Multiple Targets (UDP Flood Attack on Multiple Targets Edition)" \
     "12" "Advanced IP Flooding (Advanced IP Flood Attack)" \
     "13" "Advanced HTTP Flooding (Advanced HTTP Flood Attack)" \
     "14" "Advanced ICMP Flooding (Advanced ICMP Flood Attack)" \
     "15" "Advanced DNS Query Flood (Advanced DNS Query Flood Attack)" \
     "16" "Advanced UDP Reflection Flood (Advanced UDP Reflection Flood Attack)" \
     "17" "Advanced SYN Flood (Advanced SYN Flood Attack)" \
     "0" "Return" \
     3>&1 1>&2 2>&3)

     if [[ $? -eq 0 ]]; then
         if [[ "$choice" == "" ]]; then
             echo "Operation cancelled."
             break
         fi

         python3 "${files[$choice]}"
         break
     else
         echo "Operation cancelled."
         break
     fi
done
